﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Mosaik_complete_
{
    class directory_and_file
    {
        public static bool exist_directory(string pfad)
        {
            DirectoryInfo info = new DirectoryInfo(pfad);
            if (info.Exists == true)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static string[] get_pictures(string pfad)
        {
            DirectoryInfo info = new DirectoryInfo(pfad);
            List<string> pfadliste = new List<string>();

            FileInfo[] fi1;
            fi1 = info.GetFiles("*.jp*g", SearchOption.AllDirectories);
            FileInfo[] fi2;
            fi2 = info.GetFiles("*.bmp", SearchOption.AllDirectories);
            
            for (int i = 0; i<fi1.Length; i++)
            {
                if (fi1[i].Extension.ToLower() == ".jpg" || fi1[i].Extension.ToLower() == ".jpeg")
                    pfadliste.Add(fi1[i].FullName);
            }

            for (int i = 0; i < fi2.Length; i++)
            {
                if (fi2[i].Extension.ToLower() == ".bmp")
                    pfadliste.Add(fi2[i].FullName);
            }
            return pfadliste.ToArray();
        }
    }
}
